package com.zhengx.fragmentutildemo;

import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.zhengx.fragmentutil.BaseQuickFragment;
import com.zhengx.fragmentutil.FragmentUtil;

/**
 * name：com.zhengx.fragmentutildemo
 * class: describe
 * author: zhengx
 * create_time: 2019/5/7
 */
public class FragmentOne extends BaseQuickFragment {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public void onResume() {
        super.onResume();
        Log.e(FragmentOne.class.getSimpleName(), "普通fragment==> 可见");
    }

    @Override
    public void onPause() {
        super.onPause();
        Log.e(FragmentOne.class.getSimpleName(), "普通fragment==> 不可见");
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.layout_fragment_one, container, false);
        view.findViewById(R.id.tv_go_to).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FragmentTwo fragmentTwo = new FragmentTwo();
                FragmentUtil.findController(FragmentOne.this).start(fragmentTwo);
            }
        });
        return view;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        Log.e(FragmentOne.class.getSimpleName(), "on view created");
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

}
